<template>
	<view class="comment">
		<image class="avatar" :src="data.avatar"></image>
		<view class="content">
			<view class="top-content">
				<view class="name">{{ data.user_name }}</view>
				<view class="address">{{ data.start_address }}-{{ data.recipient_address }}</view>
			</view>
			<up-rate :count="5" v-model="data.star" active-color="#FFD954" :size="10" :gutter="1" readonly></up-rate>
			<view class="text">
				{{ data.content }}
			</view>
			<PhotoVideo v-if="data.images && data.images.length>0" status="image" :data="data.images" />
			<PhotoVideo v-if="data.video" status="video" :src="data.video" />
		</view>
	</view>
</template>

<script setup>
	import PhotoVideo from '@/components/PhotoVideo.vue'
	import {
		ref,
		onMounted
	} from 'vue'
	const props = defineProps({
		data: {
			type: Object,
			default: () => {}
		}
	})
</script>

<style lang="scss" scoped>
	.comment {
		display: flex;

		.avatar {
			width: 46rpx;
			height: 46rpx;
			margin-right: 16rpx;
			border-radius: 50%;
		}

		.content {
			width: calc(100% - 62rpx);

			.top-content {
				display: flex;
				align-items: center;

				.name {
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #A6A1A1;
					line-height: 28rpx;
					margin-right: 18rpx;
				}

				.address {
					padding: 0 10px;
					height: 36rpx;
					background: #F7F1FF;
					border-radius: 10rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 20rpx;
					color: #645AF0;
					line-height: 36rpx;
				}
			}

			.u-rate {
				margin: 10rpx 0;
			}

			.text {
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 28rpx;
				color: #2C1F21;
				line-height: 33rpx;
				margin-bottom: 10rpx;
			}
		}
	}
</style>